﻿<!DOCTYPE HTML>
<html  xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="Bookmark" href="/favicon.ico" >
<link rel="Shortcut Icon" href="/favicon.ico" />
<!--[if lt IE 9]>
	<script type="text/javascript" src="/lib/html5shiv.js"></script>
	<script type="text/javascript" src="/lib/respond.min.js"></script>
	<![endif]-->
<link rel="stylesheet" type="text/css" href="/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/css/style.css" />
	<link href="/1.0.9/iconfont.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="/js/vue/vue.min.js"></script>
	<script type="text/javascript" src="/js/laypage/laypage.js"></script>
<!--[if IE 6]>
	<script type="text/javascript" src="/static/lib/DD_belatedPNG_0.0.8a-min.js"></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
<title>仓库列表</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 仓库管理 <span class="c-gray en">&gt;</span> 仓库列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container" id="app">
	<div class="text-c">
		<input type="text" class="input-text" style="width:250px" placeholder="搜索编号、名称、联系人、电话..." id="aa" name="">
		<button type="submit" class="btn btn-success" id="bb" name="" @click="findWare()"><i class="Hui-iconfont">&#xe665;</i> 搜仓库</button>
	</div>
	<div class="cl pd-5 bg-1 bk-gray mt-20"> <span class="l"><a href="javascript:;" onclick="datadel()" class="btn btn-danger radius"><i class="Hui-iconfont">&#xe6e2;</i> 批量删除</a>
        <a href="javascript:;" onclick="admin_add('添加仓库','admin-add.html','800','500')" class="btn btn-primary radius" @click="addWare()">
            <i class="Hui-iconfont">&#xe600;</i>
            添加仓库
        </a>
    </span>

        <span class="r">共有数据：
            <strong>54</strong> 条</span> </div>
	<table class="table table-border table-bordered table-bg" >
		<thead>
			<tr>
				<th scope="col" colspan="9" width="100%">仓库列表</th>
			</tr>
			<tr class="text-c">
				<th width="25">
				<th width="40">序号</th>
				<th width="150">操作</th>
				<th width="90">编号</th>
				<th width="150">名称</th>
				<th width="150">联系人</th>
				<th width="130">联系电话</th>
				<th width="100">状态</th>
			</tr>
		</thead>
		<div >
			<tr  class="text-c" v-for="(item,index) in result" >
				<td></td>
				<td>{{index+1}}</td>
				<td>
					<a href="#" @click="detail(item.id)" class="Hui-iconfont Hui-iconfont-gengduo3" title="详细"></a>
					<a href="#" @click="EditWarHouse(item.id)" class="Hui-iconfont Hui-iconfont-edit" title="编辑"></a>
					<a href="#"  @click="deletea(item.id)" class="Hui-iconfont Hui-iconfont-del3" title="删除"></a>
				</td>
				<td>{{item.wmNumber}}</td>
				<td>{{item.wmName}}</td>
				<td>{{item.wmPerson}}</td>
				<td>{{item.wmTel}}</td>
				<td v-if="item.wmState===1">
					启用
				</td>
				<td v-else>
					禁用
				</td>
				<td>{{item.wm_name}}</td>
				<td>{{item.age}}</td>
			</tr>
        </div>
		</tbody>
	</table>
<div style="text-align:center;">
	<table class="table table-bg" style="display: none;text-align:center;" id="details">

	<tr>
        <th>仓库名:<td>{{results.wmName}}</td></th>
        <th>仓库编号:<td>{{results.wmNumber}}</td></th>
    </tr>
        <tr>

        <th>状态:</th>
					<th v-if="results.wmState===1">
						启用
					</th>
					<th v-else>
						禁用
					</th>
            <td>联系人:</td>
            <th>{{results.wmPerson}}</th>
            <th>联系电话:{{results.wmTel}}</th>
        </tr>
        <tr>
					<th>邮箱:</th>
				<th>{{results.wmPostcode}}</th>
					<th>仓库地址:</th>
				<th>{{results.wmAddress}}</th>
            <th>备注:</th>
            <th>{{results.wmRemark}}</th>
        </tr>
	</table>
</div>


	<div id="pagenav" style="text-align:center;position: fixed;left: 0px;width: 100%;"></div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
/*
	参数解释：
	title	标题
	url		请求的url
	id		需要操作的数据id
	w		弹出层宽度（缺省调默认值）
	h		弹出层高度（缺省调默认值）
*/
var app = new Vue({
    el:'#app',
    data:{
        result:[],
		results:[]
    }
});

var getUserPageList = function(curr) {
    $.ajax({
        type:'get',
        dataType:'json',
        url:'/basicdata/warehouse-management/select',
        data:{
			data:$("#aa").val(),
            pageNum: curr || 1,
            pageSize:2
        },
        success:function(msg){

            app.result = msg.list;
            console.log(app.result);
            laypage({
                cont:'pagenav',
                pages:msg.totalPage,
                first:'首页',
                last:'尾页',
                skin: '#00A0E9',
                curr: curr || 1,
                jump: function (obj, first) {
                    if (!first) {
                        getUserPageList(obj.curr);
                    }
                }
            });
        }
    });
};
getUserPageList();
/*删除仓库*/
var  deletea = function (id) {

	//询问框
	layer.confirm('您确定要删除么？', {
		btn : [ '是', '否' ]
		//按钮
	}, function() {
		//是
		$.ajax({
			type : "get",
			dataType : "json",
			url :"/basicdata/warehouse-management/deletebyid",
			data : {
				id:id
			},
			success:function() {
				console.log("123456")
				layer.msg('已经成功删除记录' + id,{icon:5});
				layer.close();
			}
		});
	}, function() {
		//否
		layer.close(true);
	});
};
/*模糊查询*/
var findWare = function () {
	getUserPageList();
	/*$.ajax({
		type:'post',
		dataType:'json',
		url:'/basicdata/warehouse-management/vagueselect',
		data:{
			data:$("#aa").val()
		},
		success:function (da) {
			console.log(da);
			console.log("da.list==="+da.list);
			app.result=da.list;
		}
	})*/
};
/*增加仓库*/
var  addWare = function () {
            layer.open({
                type:2,
                title:'添加仓库',
                fix:false,
                maxmin:true,
                shadeClose:true,
                area:['1000px','500px'],
                content:'/basicdata/warehouse-management/addWare',
                end:function(){
                    getUserPageList();
                }
            });
        };
/*编辑仓库*/
    var EditWarHouse=function (id) {
               layer.open({
                    type:2,
                    title:'编辑仓库',
                    fix:false,
                    maxmin:true,
                    shadeClose:true,
                    area:['1000px','500px'],
                   /* content:'http://localhost:8080/basicdata/editWareHouse.html',*/
                    content:'/basicdata/warehouse-management/UpdateWareHouse?id='+id,
                    end:function(){
                        getUserPageList();
                    }
                });
    }
    /*详细*/
var detail=function (id) {
    $.ajax({
        type:'post',
        dataType:'json',
        url:'/basicdata/warehouse-management/selectByid',
        data:{
            id:id
        },
        success:function(msg) {
            app.results = msg.data;
            console.log(app.results)
        },
    });
/*详细*/
	var s=document.getElementById("details")
    if(s.style.display=="none"){
        s.style.display="block"
    }else {s.style.display="none"};
};
</script>
</body>
</html>